home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cursman / cursman.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  5.8 KB  |  184 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Cursor Manipulations - (c)1992 Pierre Fillion"
  6.    ClientHeight    =   4680
  7.    ClientLeft      =   1290
  8.    ClientTop       =   1425
  9.    ClientWidth     =   6195
  10.    ControlBox      =   0   'False
  11.    Height          =   5085
  12.    Left            =   1230
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   4680
  18.    ScaleMode       =   0  'User
  19.    ScaleWidth      =   6195
  20.    Top             =   1080
  21.    Width           =   6315
  22.    Begin CommandButton Command6 
  23.       Caption         =   "&UnClip Cursor"
  24.       Height          =   315
  25.       Left            =   3450
  26.       TabIndex        =   8
  27.       Top             =   4200
  28.       Width           =   1965
  29.    End
  30.    Begin CommandButton Command5 
  31.       Caption         =   "&Clip Cursor"
  32.       Height          =   315
  33.       Left            =   750
  34.       TabIndex        =   7
  35.       Top             =   4200
  36.       Width           =   1965
  37.    End
  38.    Begin CommandButton Command4 
  39.       Caption         =   "&Show cursor"
  40.       Height          =   315
  41.       Left            =   3450
  42.       TabIndex        =   6
  43.       Top             =   3750
  44.       Width           =   1965
  45.    End
  46.    Begin CommandButton Command3 
  47.       Caption         =   "&Hide cursor"
  48.       Height          =   315
  49.       Left            =   750
  50.       TabIndex        =   5
  51.       Top             =   3750
  52.       Width           =   1965
  53.    End
  54.    Begin CommandButton Command1 
  55.       Caption         =   "E&xit"
  56.       Height          =   315
  57.       Left            =   3450
  58.       TabIndex        =   1
  59.       Top             =   3300
  60.       Width           =   1965
  61.    End
  62.    Begin CommandButton Command2 
  63.       Caption         =   "&Go to position "
  64.       Height          =   315
  65.       Left            =   750
  66.       TabIndex        =   2
  67.       Top             =   3300
  68.       Width           =   1965
  69.    End
  70.    Begin Label Label3 
  71.       Alignment       =   2  'Center
  72.       BorderStyle     =   1  'Fixed Single
  73.       Caption         =   "Click in box to set a position"
  74.       FontBold        =   -1  'True
  75.       FontItalic      =   0   'False
  76.       FontName        =   "MS Sans Serif"
  77.       FontSize        =   12
  78.       FontStrikethru  =   0   'False
  79.       FontUnderline   =   0   'False
  80.       Height          =   2565
  81.       Left            =   150
  82.       TabIndex        =   4
  83.       Top             =   600
  84.       Width           =   5865
  85.    End
  86.    Begin Label Label2 
  87.       BackColor       =   &H00C0C0C0&
  88.       BorderStyle     =   1  'Fixed Single
  89.       FontBold        =   -1  'True
  90.       FontItalic      =   0   'False
  91.       FontName        =   "MS Sans Serif"
  92.       FontSize        =   9.75
  93.       FontStrikethru  =   0   'False
  94.       FontUnderline   =   0   'False
  95.       Height          =   315
  96.       Left            =   3300
  97.       TabIndex        =   3
  98.       Top             =   150
  99.       Width           =   2715
  100.    End
  101.    Begin Label Label1 
  102.       BackColor       =   &H00C0C0C0&
  103.       BorderStyle     =   1  'Fixed Single
  104.       FontBold        =   -1  'True
  105.       FontItalic      =   0   'False
  106.       FontName        =   "MS Sans Serif"
  107.       FontSize        =   9.75
  108.       FontStrikethru  =   0   'False
  109.       FontUnderline   =   0   'False
  110.       ForeColor       =   &H00000000&
  111.       Height          =   315
  112.       Left            =   150
  113.       TabIndex        =   0
  114.       Top             =   150
  115.       Width           =   3015
  116.    End
  117. Sub Command1_Click ()
  118. 'Exit the program
  119. End Sub
  120. Sub Command2_Click ()
  121. 'Call API function to set cursor position on the screen
  122. 'defined in tPos.X and tPos.Y in Sub Label3_Click ()
  123. A% = SetCursorPos(tPos.x, tPos.Y)
  124. End Sub
  125. Sub Command3_Click ()
  126. 'Verify if the cursor is already hidden (to prevent stacking)
  127. 'If not hide it!
  128. If C_State <> C_Hide Then
  129.    Ret% = ShowCursor(C_Hide)
  130.    C_State = C_Hide
  131.    Form1.Label3.Caption = "Press Alt+S to show cursor"
  132. End If
  133. End Sub
  134. Sub Command4_Click ()
  135. 'Verify if the cursor is already showed (to prevent stacking)
  136. 'If not show it!
  137. If C_State <> C_Show Then
  138.    Ret% = ShowCursor(C_Show)
  139.    C_State = C_Show
  140.    Form1.Label3.Caption = "Click in box to set a position"
  141. End If
  142. End Sub
  143. Sub Command5_Click ()
  144. 'Clip Positions defined on Form1 positions
  145. 'Divided by 15 to convert twips in pixels for the API call
  146. ClipWin.Left = Form1.Left / 15
  147. ClipWin.Top = Form1.Top / 15
  148. ClipWin.Right = (Form1.Left + Form1.Width) / 15
  149. ClipWin.Bottom = (Form1.Top + Form1.Height) / 15
  150. Form1.Label3.Caption = "Click in box to set a position" + Chr$(13) + "Clip= T:" + Str$(ClipWin.Top) + " L:" + Str$(ClipWin.Left) + " R:" + Str$(ClipWin.Right) + " B:" + Str$(ClipWin.Bottom)
  151. 'Call API to clip cursor in positions
  152. Call ClipCursor(ClipWin)
  153. End Sub
  154. Sub Command6_Click ()
  155. 'Clip Positions defined on screen resolution
  156. 'Divided by 15 to convert twips in pixels for the API call
  157. ClipWin.Left = 0
  158. ClipWin.Top = 0
  159. ClipWin.Right = Screen.Width / 15
  160. ClipWin.Bottom = Screen.Height / 15
  161. Form1.Label3.Caption = "Click in box to set a position" + Chr$(13) + "Clip= T:" + Str$(ClipWin.Top) + " L:" + Str$(ClipWin.Left) + " R:" + Str$(ClipWin.Right) + " B:" + Str$(ClipWin.Bottom)
  162. 'Call API to clip cursor in positions
  163. Call ClipCursor(ClipWin)
  164. End Sub
  165. Sub Label3_Click ()
  166. 'Store the current position of the cursor on mouse click in Label3
  167. Call GetCursorPos(tPos)
  168. End Sub
  169. Sub Picture1_Click ()
  170. Call GetCursorPos(tPos)
  171. End Sub
  172. Sub Picture2_Click ()
  173. Call GetCursorPos(tPos)
  174. Call Main
  175. End Sub
  176. Sub Picture3_Click ()
  177. Call GetCursorPos(tPos)
  178. Call Main
  179. End Sub
  180. Sub Picture4_Click ()
  181. Call GetCursorPos(tPos)
  182. Call Main
  183. End Sub
  184.